<%--
  Created by IntelliJ IDEA.
  User: exordinaryhy
  Date: 2024/5/2
  Time: 12:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>显示学生列表</title>
</head>
<body>
<h3>显示学生列表</h3>
<form method="post" action="selectstuservlet" enctype="application/x-www-form-urlencoded">
    <table border="1" width="90%" align="center">
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>学号</th>
            <th>身份证号</th>
            <th>入学时间</th>
            <th>权限</th>
            <th>操作</th>
        </tr>
        <c:forEach var="stu" items="${pageBean.data}">
            <tr>
                <td>${stu.id}</td>
                <td>${stu.stuname}</td>
                <td>${stu.stuno}</td>
                <td>${stu.idcard}</td>
                <td><fmt:formatDate value="${stu.startdate}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                <td>
                    <c:if test="${stu.status eq 1}">
                        管理员
                    </c:if>
                    <c:if test="${stu.status eq 0}">
                        学生
                    </c:if>
                </td>
                <td>
                    <c:url var="deleteURI" value="deleteStu">
                        <c:param name="id" value="${stu.id}"></c:param>
                    </c:url>
                    <a href="${deleteURI}" onclick="return confirm('确定要删除吗？')">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</form>
<script type="text/javascript">
    $(function () {
        $("#tab tr:even").css("background-color","yellow");
        $("#tab tr:odd").css("background-color","write");
    })
</script>

<div style="width: 90%; margin: 0 auto;">
    <a href="selectstuservlet?pageNum=1&pageSize=${pageBean.pageSize}">首页</a>
    <a href="selectstuservlet?pageNum=${pageBean.pageNum-1}&pageSize=${pageBean.pageSize}">上一页</a>
    <c:forEach begin="${pageBean.startPage}" end="${pageBean.endPage}" var="num">
        <c:if test="${pageBean.pageNum==num}">
            <a class="active" href="selectstuservlet?pageNum=${num}&pageSize=${pageBean.pageSize}">${num}</a>
        </c:if>
        <c:if test="${pageBean.pageNum!=num}">
            <a href="selectstuservlet?pageNum=${num}&pageSize=${pageBean.pageSize}">${num}</a>
        </c:if>
    </c:forEach>
    <a href="selectstuservlet?pageNum=${pageBean.pageNum+1}&pageSize=${pageBean.pageSize}">下一页</a>
    <a href="selectstuservlet?pageNum=${pageBean.pageCount}&pageSize=${pageBean.pageSize}">末页</a>
    【共${pageBean.pageNum}/${pageBean.pageCount}】
</div>
</body>
</html>